//index.js
//获取应用实例
const wh = require("../../utils/wh.js");
const WxParse = require('../../wxParse/wxParse.js');
const app = getApp()

Page({
  data: {
    indicatorDots: true,//轮播圆点
    autoplay: true,//是否自动切换
    interval: 5000,//自动切换时间
    duration: 1000,//滑动动画时长
    indicatorActiveColor: '#ffffff',
    imgUrls: [
      { id: 1, img: '../../images/banner.png' },
      { id: 2, img: '../../images/banner.png' },
    ],
  
  },
  carousel: function () {
    let that = this,
    num={
      num:10
    },
      postUrl = '/api/common.carousel/get_carousel_list'; 
    wh.Post(postUrl, num, function (res) {
      that.setData({
        imgUrls: res
      });
    });
  },
  loop: function () {
    let that = this,
      postUrl = '/api/madetoorder.decorate.index/get_com_desc'; 
    wh.Post(postUrl, {}, function (res) {
      if (res != '' && res != undefined && res != null) {
        WxParse.wxParse('company_desc', 'html', res, that);      
      }
      that.setData({
        list: res
      });
    });
    this.get_setting()
  },
  //获取小程序设置
  get_setting: function () {
    let that = this;
    wh.Post('/api/setting/get', {}, function (res) {
      that.setData({ setting: res });
      // that.audio_setting();//获取成功后返回
    })
  },
  //事件处理函数
  onLoad: function () {
    this.carousel();
    this.loop();
  },
  // * 页面相关事件处理函数--监听用户下拉动作
  // * /
  onPullDownRefresh: function () {
    this.loop();
    wx.stopPullDownRefresh();
  },
  //用户点击右上角分享
  onShareAppMessage: function () {
  },
  onShow: function() {
    app.app_auth(this)
  }
})
